border
The border property adds a border around the view using the specified style and optional width. This allows you to visually outline views with solid colors, gradients, or system materials, and support light/dark mode adaptations.
Definition
style: Required. Defines the visual appearance of the border. AcceptsShapeStyleorDynamicShapeStyle.width: Optional. Specifies the thickness of the border in pixels. Defaults to1.
Usage Examples
Basic Solid Color Border
Default Width Border (1px)
Gradient Border
Dynamic Border Style (Light/Dark Mode)
Notes
- The border surrounds the entire view, respecting its layout and frame.
- You can use any
ShapeStyle, including material blur styles like"regularMaterial"or"ultraThinMaterial"for a more iOS-native look.
